﻿using Autofac;
using netcore_comm.JWT;
using netcore_comm.Nlog;
using netcore_comm.Polly;
using netcore_comm.Redis;
using netcore_comm.SqlSugar;
using netcore_service.IRepository;
using netcore_service.IService;
using netcore_service.Repositories;
using netcore_service.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace netcore_service
{
    public class ServiceRegistration : Autofac.Module
    {
        /// <summary>
        /// DI
        /// </summary>
        /// <param name="builder"></param>
        protected override void Load(ContainerBuilder builder)
        {
            builder.RegisterType<NLogHelper>().As<INLogHelper>().SingleInstance();
            builder.RegisterType<SqlSugarFactory>().As<ISqlSugarFactory>();
            builder.RegisterType<JWTHSService>().As<IJWTService>();
            builder.RegisterType<RedisHelper>().SingleInstance();
            builder.RegisterType<SchoolRepository>().As<ISchoolRepository>();
            builder.RegisterType<SchoolService>().As<ISchoolService>();
            builder.RegisterType<ManagerService>().As<IManagerService>();
            builder.RegisterType<ManagerRepository>().As<IManagerRepository>();
            builder.RegisterType<AdSpaceService>().As<IAdSpaceService>();
            builder.RegisterType<AdSpaceRepository>().As<IAdSpaceRepository>();
            builder.RegisterType<MeetingService>().As<IMeetingService>();
            builder.RegisterType<MeetingRepository>().As<IMeetingRepository>();
            builder.RegisterType<MeetSubmitInfoService>().As<IMeetSubmitInfoService>();
            builder.RegisterType<MeetSubmitInfoRepository>().As<IMeetSubmitInfoRepository>();
            builder.RegisterType<MessageRepository>().As<IMessageRepository>();
            builder.RegisterType<ChatRepository>().As<IChatRepository>();
            builder.RegisterType<UserConnectionManager>().As<IUserConnectionManager>();
            builder.RegisterType<ChatService>().As<IChatService>();

        }
    }
}
